
import 'package:flutter/material.dart';
import 'package:flutter_study_lib/utils/ThemeUtil.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';

class BaseWebPage extends StatefulWidget {
  final String title;
  final String url;
  BaseWebPage({Key key,this.title,this.url}) : super(key:key);

  @override
  _BaseWebPageState createState() => _BaseWebPageState();
}

class _BaseWebPageState extends State<BaseWebPage> {
  bool loading = true;

  final flutterWebViewPlugin = FlutterWebviewPlugin();

  @override
  void initState() {
    super.initState();
    flutterWebViewPlugin.onStateChanged.listen((state) {

    });
    flutterWebViewPlugin.onUrlChanged.listen((url){
      setState(() {
        loading = false;
      });
    });
  }
  @override
  Widget build(BuildContext context) {
    return WebviewScaffold(
      url: widget.url,
      appBar: AppBar(
        title: Text(widget.title,style: ThemeUtil.navigtionar_textStyle,),
        backgroundColor: ThemeUtil.themeColor,),
    );
  }
}